package org.ccay.hypertext.service.impl;

import javax.inject.Inject;
import javax.inject.Named;

import org.ccay.core.base.PageVO;
import org.ccay.core.base.PagedResult;
import org.ccay.core.exception.ApplicationException;
import org.ccay.hypertext.MailTemplate;
import org.ccay.hypertext.dao.IMailTemplateDao;
import org.ccay.hypertext.dao.IPlainHyperTextDao;
import org.ccay.hypertext.dao.IStaticResourceDao;
import org.ccay.hypertext.service.IHyperTextService;

@Named("mailTemplateHyperTextService")
public class MailTemplateHyperTextService implements IHyperTextService<MailTemplate>{

	@Inject
	private IMailTemplateDao mailTemplateDao;
	
	@Inject
	private IPlainHyperTextDao plainHyperTextDao;
	
	@Override
	public MailTemplate findHyperText(MailTemplate hyperText) {
		return mailTemplateDao.findHyperText(hyperText);
	}

	@Override
	public void create(MailTemplate hyperText) throws ApplicationException {
		plainHyperTextDao.create(hyperText);
		mailTemplateDao.updateTitle(hyperText);
		
	}

	@Override
	public void delete(MailTemplate hyperText) throws ApplicationException {
		plainHyperTextDao.delete(hyperText);
	}

	@Override
	public PagedResult<MailTemplate> findPagedHypertextList(MailTemplate hypertext, PageVO page) {
		return mailTemplateDao.findPagedHypertextList(hypertext,page);
	}
}
